Conditions | 1 |
Paths | 1 |
Total Lines | 39 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | var InsCode = function() |
||
2 | { |
||
3 | return { |
||
4 | display: function(markItUp) { |
||
5 | console.log(markItUp); |
||
|
|||
6 | var textareaID = markItUp.textarea.id; |
||
7 | var textarea = $('#' + textareaID); |
||
8 | var output = ''; |
||
9 | $('#ins-code-form').remove(); |
||
10 | $.get(markItUp.root + 'InsCode/InsCode.html', function (data) { |
||
11 | $('body').append(data); |
||
12 | var form = $('#ins-code-form'); |
||
13 | |||
14 | form.css({ |
||
15 | 'top': textarea.position().top + 5, |
||
16 | 'left': textarea.closest('.markItUpContainer').find('li.ins-code-button').position().left - 322 |
||
17 | }); |
||
18 | form.find('#ins-code-code').val(markItUp.selection); |
||
19 | |||
20 | form.find('a.cancel').click(function (e) { |
||
21 | e.preventDefault(); |
||
22 | form.fadeOut(function () { |
||
23 | form.remove(); |
||
24 | }); |
||
25 | }); |
||
26 | |||
27 | form.fadeIn(); |
||
28 | |||
29 | form.on('submit', function(e) { |
||
30 | e.preventDefault(); |
||
31 | $.markItUp({target: '#' + textareaID, openWith: '<pre lang="' + $(this).find('#ins-code-language').val() + '">', closeWith: '</pre>', placeHolder:$(this).find('#ins-code-code').val()}); |
||
32 | form.fadeOut(function () { |
||
33 | form.remove(); |
||
34 | }); |
||
35 | }); |
||
36 | }); |
||
37 | } |
||
38 | } |
||
39 | }(); |
||
40 |